#ifndef __WINDOWSPLATFORM_INCLUDED
#define __WINDOWSPLATFORM_INCLUDED

namespace Audio
{
	namespace WindowsPlatform
	{

		class WindowsLocker : public ILocker
		{
		public:
			WindowsLocker();
			~WindowsLocker();
			virtual void Lock();
			virtual void Unlock();

		private:
			CRITICAL_SECTION cs;
		};


		class WindowsThread : public IThread
		{
		public:
			WindowsThread();
			~WindowsThread();

			virtual void Start(IRunable* run);			
			virtual void Join();
			virtual void Stop();
			virtual BOOL HasStopRequest();
		private:
			static DWORD WINAPI ThreadEntry(LPVOID param);
			HANDLE threadHandle;
			IRunable*	runalbe;
			BOOL		isRunning;
			BOOL        hasStopRequest;
		};

		class WindowsEvent : public IEvent
		{
		public:
			WindowsEvent();
			~WindowsEvent();

			virtual void Signal();
			virtual void WaitOn();
		private:
			HANDLE eventHandle;
		};	
		

		class WindowsFactory : public IFactory
		{
		public:
			virtual IAudioDevice* CreateAudioDevice();
			virtual void DestroyAudioDevice(IAudioDevice*& device);

			virtual ILocker* CreateLocker();
			virtual void DestroyLocker(ILocker*& locker);

			virtual IThread* CreateThread();
			virtual void DestroyThread(IThread*& t);

			virtual IEvent* CreateEventObject();
			virtual void DestroyEventObject(IEvent*& e);
			
		};

	}
}

#endif //__WINDOWSPLATFORM_INCLUDED